from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    # 步骤1:点击搜索
    def sousuo(self):
        loc=(By.XPATH,'//android.widget.ViewSwitcher[@resource-id="com.achievo.vipshop:id/index_search_custom_hint"]/android.widget.RelativeLayout')
        ele=self.find_ele(loc)
        return ele
    # 步骤2:输入搜索内容
    def sousuo2(self):
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele
    # 步骤3:再次点击搜索
    def dianjisousuo(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.achievo.vipshop:id/tv_search")')
        ele=self.find_ele(loc)
        return ele
    # 步骤4:点击搜索出来的图片
    def tupian(self):
        loc=(By.XPATH,'(//android.widget.RelativeLayout[@resource-id="com.achievo.vipshop:id/image_main_layout"])[1]/android.widget.FrameLayout')
        ele=self.find_ele(loc)
        return ele
    # 步骤5:点击收藏
    def shoucang(self):
        loc=(By.ID,'com.achievo.vipshop:id/img')
        ele=self.find_ele(loc)
        return ele
    # 步骤6:返回
    def fanhui(self):
        loc=(By.ID,'com.achievo.vipshop:id/btn_round_back_icon')
        ele=self.find_ele(loc)
        return ele
    # 断言
    def duanyan(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("com.achievo.vipshop:id/text_sort_price")')
        ele=self.find_ele(loc)
        return ele